<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>ChunkSeqReader (PNGJ 2.1.1-SNAPSHOT API)</title>
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="ChunkSeqReader (PNGJ 2.1.1-SNAPSHOT API)";
    }
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!--   -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/ChunkSeqReader.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../ar/com/hjg/pngj/ChunkSeqBuffering.html" title="class in ar.com.hjg.pngj"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../ar/com/hjg/pngj/ChunkSeqReaderPng.html" title="class in ar.com.hjg.pngj"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?ar/com/hjg/pngj/ChunkSeqReader.html" target="_top">Frames</a></li>
<li><a href="ChunkSeqReader.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">ar.com.hjg.pngj</div>
<h2 title="Class ChunkSeqReader" class="title">Class ChunkSeqReader</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>ar.com.hjg.pngj.ChunkSeqReader</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../../../ar/com/hjg/pngj/IBytesConsumer.html" title="interface in ar.com.hjg.pngj">IBytesConsumer</a></dd>
</dl>
<dl>
<dt>Direct Known Subclasses:</dt>
<dd><a href="../../../../ar/com/hjg/pngj/ChunkSeqBuffering.html" title="class in ar.com.hjg.pngj">ChunkSeqBuffering</a>, <a href="../../../../ar/com/hjg/pngj/ChunkSeqReaderPng.html" title="class in ar.com.hjg.pngj">ChunkSeqReaderPng</a>, <a href="../../../../ar/com/hjg/pngj/ChunkSeqSkipping.html" title="class in ar.com.hjg.pngj">ChunkSeqSkipping</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong">ChunkSeqReader</span>
extends <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>
implements <a href="../../../../ar/com/hjg/pngj/IBytesConsumer.html" title="interface in ar.com.hjg.pngj">IBytesConsumer</a></pre>
<div class="block">Consumes a stream of bytes that consist of a series of PNG-like chunks.
 <p>
 This has little intelligence, it's quite low-level and general (it could even be used for a MNG stream, for example).
 It supports signature recognition and idat deflate</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!--   -->
</a>
<h3>Field Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected static int</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#SIGNATURE_LEN">SIGNATURE_LEN</a></strong></code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#withSignature">withSignature</a></strong></code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!--   -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#ChunkSeqReader()">ChunkSeqReader</a></strong>()</code>
<div class="block">Creates a ChunkSeqReader (with signature)</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#ChunkSeqReader(boolean)">ChunkSeqReader</a></strong>(boolean&nbsp;withSignature)</code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!--   -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#checkSignature(byte[])">checkSignature</a></strong>(byte[]&nbsp;buf)</code>
<div class="block">Throws PngjInputException if bad signature</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#close()">close</a></strong>()</code>
<div class="block">Closes this object and release resources.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#consume(byte[], int, int)">consume</a></strong>(byte[]&nbsp;buffer,
       int&nbsp;offset,
       int&nbsp;len)</code>
<div class="block">Consumes (in general, partially) a number of bytes.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected <a href="../../../../ar/com/hjg/pngj/ChunkReader.html" title="class in ar.com.hjg.pngj">ChunkReader</a></code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#createChunkReaderForNewChunk(java.lang.String, int, long, boolean)">createChunkReaderForNewChunk</a></strong>(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;id,
                            int&nbsp;len,
                            long&nbsp;offset,
                            boolean&nbsp;skip)</code>
<div class="block">This will be called for all chunks (even skipped), except for IDAT-like non-skiped chunks
 
 The default behaviour is to create a ChunkReader in BUFFER mode (or SKIP if skip==true) that calls
 <a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#postProcessChunk(ar.com.hjg.pngj.ChunkReader)"><code>postProcessChunk(ChunkReader)</code></a> (always) when done.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected <a href="../../../../ar/com/hjg/pngj/DeflatedChunksSet.html" title="class in ar.com.hjg.pngj">DeflatedChunksSet</a></code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#createIdatSet(java.lang.String)">createIdatSet</a></strong>(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;id)</code>
<div class="block">DeflatedChunksSet factory.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#endChunkId()">endChunkId</a></strong>()</code>
<div class="block">Which should be the id of the last chunk</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#feedAll(byte[], int, int)">feedAll</a></strong>(byte[]&nbsp;buf,
       int&nbsp;off,
       int&nbsp;len)</code>
<div class="block">Trys to feeds exactly <tt>len</tt> bytes, calling <a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#consume(byte[], int, int)"><code>consume(byte[], int, int)</code></a> retrying if necessary.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#feedFromFile(java.io.File)">feedFromFile</a></strong>(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>&nbsp;f)</code>
<div class="block">Reads all content from a file.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#feedFromInputStream(java.io.InputStream)">feedFromInputStream</a></strong>(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;is)</code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#feedFromInputStream(java.io.InputStream, boolean)">feedFromInputStream</a></strong>(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;is,
                   boolean&nbsp;closeStream)</code>
<div class="block">Reads all content from an input stream.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#firstChunkId()">firstChunkId</a></strong>()</code>
<div class="block">Which should be the id of the first chunk</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#getBytesCount()">getBytesCount</a></strong>()</code>
<div class="block">total of bytes read (buffered or not)</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#getChunkCount()">getChunkCount</a></strong>()</code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../ar/com/hjg/pngj/ChunkReader.html" title="class in ar.com.hjg.pngj">ChunkReader</a></code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#getCurChunkReader()">getCurChunkReader</a></strong>()</code>
<div class="block">Currently reading chunk, or just ended reading</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../ar/com/hjg/pngj/DeflatedChunksSet.html" title="class in ar.com.hjg.pngj">DeflatedChunksSet</a></code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#getCurReaderDeflatedSet()">getCurReaderDeflatedSet</a></strong>()</code>
<div class="block">The latest deflated set (typically IDAT chunks) reader.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#getIdatBytes()">getIdatBytes</a></strong>()</code>
<div class="block">Helper method, reports amount of bytes inside IDAT chunks.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#isAtChunkBoundary()">isAtChunkBoundary</a></strong>()</code>
<div class="block">Returns true if we are not in middle of a chunk: we have just ended reading past chunk , or we are at the start, or
 end of signature, or we are done</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#isDone()">isDone</a></strong>()</code>
<div class="block">If true, we either have processe the IEND chunk, or close() has been called, or a fatal error has happened</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#isIdatKind(java.lang.String)">isIdatKind</a></strong>(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;id)</code>
<div class="block">Decides if this Chunk is of "IDAT" kind (in concrete: if it is, and if it's not to be skiped, a DeflatedChunksSet
 will be created to deflate it and process+ the deflated data)
 
 This implementation always returns always false</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#isSignatureDone()">isSignatureDone</a></strong>()</code>
<div class="block">If false, we are still reading the signature</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#postProcessChunk(ar.com.hjg.pngj.ChunkReader)">postProcessChunk</a></strong>(<a href="../../../../ar/com/hjg/pngj/ChunkReader.html" title="class in ar.com.hjg.pngj">ChunkReader</a>&nbsp;chunkR)</code>
<div class="block">This is called after a chunk is read, in all modes
 
 This implementation only chenks the id of the first chunk, and process the IEND chunk (sets done=true)
 
 Further processing should be overriden (call this first!)</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#shouldCheckCrc(int, java.lang.String)">shouldCheckCrc</a></strong>(int&nbsp;len,
              <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;id)</code>&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#shouldSkipContent(int, java.lang.String)">shouldSkipContent</a></strong>(int&nbsp;len,
                 <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;id)</code>
<div class="block">Chunks can be skipped depending on id and/or length.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#startNewChunk(int, java.lang.String, long)">startNewChunk</a></strong>(int&nbsp;len,
             <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;id,
             long&nbsp;offset)</code>
<div class="block">Called for all chunks when a chunk start has been read (id and length), before the chunk data itself is read.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!--   -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!--   -->
</a>
<h3>Field Detail</h3>
<a name="SIGNATURE_LEN">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SIGNATURE_LEN</h4>
<pre>protected static final&nbsp;int SIGNATURE_LEN</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../constant-values.html#ar.com.hjg.pngj.ChunkSeqReader.SIGNATURE_LEN">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="withSignature">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>withSignature</h4>
<pre>protected final&nbsp;boolean withSignature</pre>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!--   -->
</a>
<h3>Constructor Detail</h3>
<a name="ChunkSeqReader()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ChunkSeqReader</h4>
<pre>public&nbsp;ChunkSeqReader()</pre>
<div class="block">Creates a ChunkSeqReader (with signature)</div>
</li>
</ul>
<a name="ChunkSeqReader(boolean)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>ChunkSeqReader</h4>
<pre>public&nbsp;ChunkSeqReader(boolean&nbsp;withSignature)</pre>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>withSignature</code> - If true, the stream is assumed be prepended by 8 bit signature</dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!--   -->
</a>
<h3>Method Detail</h3>
<a name="consume(byte[], int, int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>consume</h4>
<pre>public&nbsp;int&nbsp;consume(byte[]&nbsp;buffer,
          int&nbsp;offset,
          int&nbsp;len)</pre>
<div class="block">Consumes (in general, partially) a number of bytes. A single call never involves more than one chunk.
 
 When the signature is read, it calls checkSignature()
 
 When the start of a chunk is detected, it calls <a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#startNewChunk(int, java.lang.String, long)"><code>startNewChunk(int, String, long)</code></a>
 
 When data from a chunk is being read, it delegates to <a href="../../../../ar/com/hjg/pngj/ChunkReader.html#feedBytes(byte[], int, int)"><code>ChunkReader.feedBytes(byte[], int, int)</code></a>
 
 The caller might want to call this method more than once in succesion
 
 This should rarely be overriden</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../ar/com/hjg/pngj/IBytesConsumer.html#consume(byte[], int, int)">consume</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../ar/com/hjg/pngj/IBytesConsumer.html" title="interface in ar.com.hjg.pngj">IBytesConsumer</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>buffer</code> - </dd><dd><code>offset</code> - Offset in buffer</dd><dd><code>len</code> - Valid bytes that can be consumed</dd>
<dt><span class="strong">Returns:</span></dt><dd>processed bytes, in the 1-len range. -1 if done. Only returns 0 if len=0.</dd></dl>
</li>
</ul>
<a name="feedAll(byte[], int, int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>feedAll</h4>
<pre>public&nbsp;boolean&nbsp;feedAll(byte[]&nbsp;buf,
              int&nbsp;off,
              int&nbsp;len)</pre>
<div class="block">Trys to feeds exactly <tt>len</tt> bytes, calling <a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#consume(byte[], int, int)"><code>consume(byte[], int, int)</code></a> retrying if necessary.
 
 This should only be used in callback mode</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>true if succceded</dd></dl>
</li>
</ul>
<a name="startNewChunk(int, java.lang.String, long)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>startNewChunk</h4>
<pre>protected&nbsp;void&nbsp;startNewChunk(int&nbsp;len,
                 <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;id,
                 long&nbsp;offset)</pre>
<div class="block">Called for all chunks when a chunk start has been read (id and length), before the chunk data itself is read. It
 creates a new ChunkReader (field accesible via <a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#getCurChunkReader()"><code>getCurChunkReader()</code></a>) in the corresponding mode, and
 eventually a curReaderDeflatedSet.(field accesible via <a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#getCurReaderDeflatedSet()"><code>getCurReaderDeflatedSet()</code></a>)
 
 To decide the mode and options, it calls <a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#shouldCheckCrc(int, java.lang.String)"><code>shouldCheckCrc(int, String)</code></a>,
 <a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#shouldSkipContent(int, java.lang.String)"><code>shouldSkipContent(int, String)</code></a>, <a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#isIdatKind(java.lang.String)"><code>isIdatKind(String)</code></a>. Those methods should be overriden in
 preference to this; if overriden, this should be called first.
 
 The respective <a href="../../../../ar/com/hjg/pngj/ChunkReader.html#chunkDone()"><code>ChunkReader.chunkDone()</code></a> method is directed to this <a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#postProcessChunk(ar.com.hjg.pngj.ChunkReader)"><code>postProcessChunk(ChunkReader)</code></a>.
 
 Instead of overriding this, see also <a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#createChunkReaderForNewChunk(java.lang.String, int, long, boolean)"><code>createChunkReaderForNewChunk(String, int, long, boolean)</code></a></div>
</li>
</ul>
<a name="createChunkReaderForNewChunk(java.lang.String, int, long, boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createChunkReaderForNewChunk</h4>
<pre>protected&nbsp;<a href="../../../../ar/com/hjg/pngj/ChunkReader.html" title="class in ar.com.hjg.pngj">ChunkReader</a>&nbsp;createChunkReaderForNewChunk(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;id,
                                       int&nbsp;len,
                                       long&nbsp;offset,
                                       boolean&nbsp;skip)</pre>
<div class="block">This will be called for all chunks (even skipped), except for IDAT-like non-skiped chunks
 
 The default behaviour is to create a ChunkReader in BUFFER mode (or SKIP if skip==true) that calls
 <a href="../../../../ar/com/hjg/pngj/ChunkSeqReader.html#postProcessChunk(ar.com.hjg.pngj.ChunkReader)"><code>postProcessChunk(ChunkReader)</code></a> (always) when done.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>id</code> - Chunk id</dd><dd><code>len</code> - Chunk length</dd><dd><code>offset</code> - offset inside PNG stream , merely informative</dd><dd><code>skip</code> - flag: is true, the content will not be buffered (nor processed)</dd>
<dt><span class="strong">Returns:</span></dt><dd>a newly created ChunkReader that will create the ChunkRaw and then discarded</dd></dl>
</li>
</ul>
<a name="postProcessChunk(ar.com.hjg.pngj.ChunkReader)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>postProcessChunk</h4>
<pre>protected&nbsp;void&nbsp;postProcessChunk(<a href="../../../../ar/com/hjg/pngj/ChunkReader.html" title="class in ar.com.hjg.pngj">ChunkReader</a>&nbsp;chunkR)</pre>
<div class="block">This is called after a chunk is read, in all modes
 
 This implementation only chenks the id of the first chunk, and process the IEND chunk (sets done=true)
 
 Further processing should be overriden (call this first!)</div>
</li>
</ul>
<a name="createIdatSet(java.lang.String)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createIdatSet</h4>
<pre>protected&nbsp;<a href="../../../../ar/com/hjg/pngj/DeflatedChunksSet.html" title="class in ar.com.hjg.pngj">DeflatedChunksSet</a>&nbsp;createIdatSet(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;id)</pre>
<div class="block">DeflatedChunksSet factory. This implementation is quite dummy, it usually should be overriden.</div>
</li>
</ul>
<a name="isIdatKind(java.lang.String)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isIdatKind</h4>
<pre>protected&nbsp;boolean&nbsp;isIdatKind(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;id)</pre>
<div class="block">Decides if this Chunk is of "IDAT" kind (in concrete: if it is, and if it's not to be skiped, a DeflatedChunksSet
 will be created to deflate it and process+ the deflated data)
 
 This implementation always returns always false</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>id</code> - </dd></dl>
</li>
</ul>
<a name="shouldSkipContent(int, java.lang.String)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>shouldSkipContent</h4>
<pre>protected&nbsp;boolean&nbsp;shouldSkipContent(int&nbsp;len,
                        <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;id)</pre>
<div class="block">Chunks can be skipped depending on id and/or length. Skipped chunks are still processed, but their data will be
 null, and CRC will never checked</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>len</code> - </dd><dd><code>id</code> - </dd></dl>
</li>
</ul>
<a name="shouldCheckCrc(int, java.lang.String)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>shouldCheckCrc</h4>
<pre>protected&nbsp;boolean&nbsp;shouldCheckCrc(int&nbsp;len,
                     <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;id)</pre>
</li>
</ul>
<a name="checkSignature(byte[])">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>checkSignature</h4>
<pre>protected&nbsp;void&nbsp;checkSignature(byte[]&nbsp;buf)</pre>
<div class="block">Throws PngjInputException if bad signature</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>buf</code> - Signature. Should be of length 8</dd></dl>
</li>
</ul>
<a name="isSignatureDone()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isSignatureDone</h4>
<pre>public&nbsp;boolean&nbsp;isSignatureDone()</pre>
<div class="block">If false, we are still reading the signature</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>true if signature has been read (or if we don't have signature)</dd></dl>
</li>
</ul>
<a name="isDone()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isDone</h4>
<pre>public&nbsp;boolean&nbsp;isDone()</pre>
<div class="block">If true, we either have processe the IEND chunk, or close() has been called, or a fatal error has happened</div>
</li>
</ul>
<a name="getBytesCount()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getBytesCount</h4>
<pre>public&nbsp;long&nbsp;getBytesCount()</pre>
<div class="block">total of bytes read (buffered or not)</div>
</li>
</ul>
<a name="getChunkCount()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getChunkCount</h4>
<pre>public&nbsp;int&nbsp;getChunkCount()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>Chunks already read, including partial reading (currently reading)</dd></dl>
</li>
</ul>
<a name="getCurChunkReader()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCurChunkReader</h4>
<pre>public&nbsp;<a href="../../../../ar/com/hjg/pngj/ChunkReader.html" title="class in ar.com.hjg.pngj">ChunkReader</a>&nbsp;getCurChunkReader()</pre>
<div class="block">Currently reading chunk, or just ended reading</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>null only if still reading signature</dd></dl>
</li>
</ul>
<a name="getCurReaderDeflatedSet()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCurReaderDeflatedSet</h4>
<pre>public&nbsp;<a href="../../../../ar/com/hjg/pngj/DeflatedChunksSet.html" title="class in ar.com.hjg.pngj">DeflatedChunksSet</a>&nbsp;getCurReaderDeflatedSet()</pre>
<div class="block">The latest deflated set (typically IDAT chunks) reader. Notice that there could be several idat sets (eg for APNG)</div>
</li>
</ul>
<a name="close()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>close</h4>
<pre>public&nbsp;void&nbsp;close()</pre>
<div class="block">Closes this object and release resources. For normal termination or abort. Secure and idempotent.</div>
</li>
</ul>
<a name="isAtChunkBoundary()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isAtChunkBoundary</h4>
<pre>public&nbsp;boolean&nbsp;isAtChunkBoundary()</pre>
<div class="block">Returns true if we are not in middle of a chunk: we have just ended reading past chunk , or we are at the start, or
 end of signature, or we are done</div>
</li>
</ul>
<a name="firstChunkId()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>firstChunkId</h4>
<pre>protected&nbsp;<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;firstChunkId()</pre>
<div class="block">Which should be the id of the first chunk</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>null if you don't want to check it</dd></dl>
</li>
</ul>
<a name="getIdatBytes()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getIdatBytes</h4>
<pre>public&nbsp;long&nbsp;getIdatBytes()</pre>
<div class="block">Helper method, reports amount of bytes inside IDAT chunks.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>Bytes in IDAT chunks</dd></dl>
</li>
</ul>
<a name="endChunkId()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>endChunkId</h4>
<pre>protected&nbsp;<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;endChunkId()</pre>
<div class="block">Which should be the id of the last chunk</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>"IEND"</dd></dl>
</li>
</ul>
<a name="feedFromFile(java.io.File)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>feedFromFile</h4>
<pre>public&nbsp;void&nbsp;feedFromFile(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>&nbsp;f)</pre>
<div class="block">Reads all content from a file. Helper method, only for callback mode</div>
</li>
</ul>
<a name="feedFromInputStream(java.io.InputStream, boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>feedFromInputStream</h4>
<pre>public&nbsp;void&nbsp;feedFromInputStream(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;is,
                       boolean&nbsp;closeStream)</pre>
<div class="block">Reads all content from an input stream. Helper method, only for callback mode</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>is</code> - </dd><dd><code>closeStream</code> - Closes the input stream when done (or if error)</dd></dl>
</li>
</ul>
<a name="feedFromInputStream(java.io.InputStream)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>feedFromInputStream</h4>
<pre>public&nbsp;void&nbsp;feedFromInputStream(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;is)</pre>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!--   -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/ChunkSeqReader.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../ar/com/hjg/pngj/ChunkSeqBuffering.html" title="class in ar.com.hjg.pngj"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../ar/com/hjg/pngj/ChunkSeqReaderPng.html" title="class in ar.com.hjg.pngj"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?ar/com/hjg/pngj/ChunkSeqReader.html" target="_top">Frames</a></li>
<li><a href="ChunkSeqReader.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2014. All rights reserved.</small></p>
</body>
</html>
